home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / ask2.arc / ASK2.DOC < prev   
Encoding:
Text File  |  1985-07-07  |  2.1 KB  |  83 lines

  1. ASK.COM  -  Batch file utility sets ERRORLEVEL according to user input.
  2.  
  3. Published in Programmers Journal Vol 3, No. 2 by Dan Rollins
  4. Modified for both IBM and Victor 9000 compatibility by Guy Gordon 6/4/85
  5.  
  6. sytax:
  7.  
  8. ASK prompt-string
  9.  
  10. The prompt-string is displayed followed by 1 space, then the 
  11. program pauses till a key is pressed.  If the key is acceptable 
  12. it is displayed, (followed by CR) and ERRORLEVEL is set.
  13. Otherwise a beep is sounded and the program continues to wait.
  14.  
  15.             valid     |  returned
  16.            replies    | ERRORLEVEL
  17.         ------------------------
  18.         ESC           |    0
  19.         0  q  Q  F10  |    0
  20.         1  y  Y  F1   |    1
  21.         2  n  N  F2   |    2
  22.         3        F3   |    3
  23.         .        .    |    .
  24.         .        .    |    .
  25.         9        F9   |    9
  26.  
  27. Example usage in a batch file:
  28.  
  29. echo off
  30. rem *** powerup menu for AAAA Managerial Consultants, Inc. ***
  31.  
  32. :START
  33. cls
  34. echo ================= M E N U ================
  35. echo =                                        =
  36. echo =      [1]  Lotus 1-2-3                  =
  37. echo =                                        =
  38. echo =      [2]  Wordstar                     =
  39. echo =                                        =
  40. echo =      [3]  Manage-Man Menu              =
  41. echo =                                        =
  42. echo =                                        =
  43. echo =      [Q]  Quit and exit to DOS         =
  44. echo =                                        =
  45. echo ==========================================
  46. echo ^I
  47. echo ^I
  48. ask Select option or Quit (1,2,3, or Q):
  49. if not errorlevel 1 goto QUIT
  50. if not errorlevel 2 goto 123
  51. if not errorlevel 3 goto WS
  52. if not errorlevel 4 goto MM
  53. echo ^I
  54. echo ^G invalid response!
  55. goto START
  56.  
  57. :MM
  58. cd \mm
  59. manager
  60. cd \
  61. goto START
  62.  
  63. :WS
  64. cd \wp\ws
  65. mode com1:12,n,8,1,p >NUL
  66. mode lpt1:=com1      >NUL
  67. ws
  68. cd \
  69. goto START
  70.  
  71. :123
  72. cd \lotus
  73. 123
  74. cd \
  75. goto START
  76.  
  77. :QUIT
  78. cls
  79. echo ======= Exiting to PC DOS ========
  80. echo == enter MENU to return to menu ==
  81. echo ==================================
  82.